<?php
// +----------------------------------------------------------------------
// | LuShop [ Lulu COMPANY WEB SHOW]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://www.luluui.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: uuleaf <uuleaf@163.com>
// +----------------------------------------------------------------------
class BulletinAction extends MbaseAction {
	public $tbname = 'bulletin';
	public $obj = 'bulletin';
	public $mpk = 'bulletin_id';
	public function index(){
		$m = M('Bulletin');
		$datalist = $m->order('oid asc')->select();
		$this->assign('datalist',$datalist);
		$this->display();
	}
	
	public function update(){
		foreach($_POST['bulletin'] as $k => $vo){
			if(is_array($vo)){
				$data = array(
					'title' => $vo['title'],
					'thumb'   => $vo['thumb'],
					'url'   => $vo['url'],
					'oid'   => $vo['oid']
				);
				$m = M('Bulletin');
				$map['bulletin_id'] = $k;
				$m->where($map)->save($data);
			}
		}
		$this->setReload('navtab',MODULE_NAME.'_index');
		$this->success('更新成功',1);
	}
}
?>